<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>文件编辑</title>
<link type="text/css" rel="stylesheet" href="main.css"/>
<script src="jquery.js" language="javascript" type="text/javascript"></script>
<script src="base.js" language="javascript" type="text/javascript"></script>

<style type="text/css">
.selbt {
	width:120px;
	float:left;
	margin:2px 0px 2px 3px;
	text-align:center;
}
.helpdiv {
 	display:none;
	border: 1px dashed #749F4D;
  	background-color: #F0FAEB;
	width:500px;
	padding:5px;
	position:absolute;
}
</style>
<script  language="javascript">
function Post()
{
	if (document.form1.filename.value=="")
	{
		alert("文件名不能为空。");
		document.form1.filename.focus();
		return false;
	}
}
function showdiv(id)
{
	hideobj = GETNAMES("help111");
	for(i=0;i<hideobj.length;i++)
	{
		hideobj[i].style.display="none";
	}
	if(id != '')
	{
		 document.getElementById(id).style.display="block";
	}
}
function GETNAMES(name)
{
	var returns = document.getElementsByName(name);
	 if(returns.length > 0) return returns;
	 returns = new Array();
	 var e = document.getElementsByTagName('div');
	 for(i = 0; i < e.length; i++)
	{
		 if(e[i].getAttribute("name") == name)
		 {
			 returns[returns.length] = e[i];
		}
	 }
	 return returns;
}
</script>
</head>
<body>
<div class="mtitle">
  <div class="lbox">文件编辑</div>
</div>
<table class="tform">
  <tbody>
    <tr>
      <td align="left">&nbsp;◇<a href='templets_main.php?acdir=<?php echo $acdir; ?>'><b>模板管理</b></a> &gt;&gt; <b>修改/新建模板</b></td>
      <td align="right"></td>
    </tr>
  </tbody>
</table>
<form method="POST" action="tpl.php" name=form1 onSubmit="return Post()">
<input type="hidden" name="action" value="saveedit" />
<input type="hidden" name="acdir" value="<?php echo $acdir; ?>" />
<table _dlist="line" class="tlist">
		<tr bgcolor='#F7FAF3'>
			<td colspan='2' height='26'>
					<font color='#666600'><b>修改/新建模板：</b></font>
			</td>
		</tr>
		<tr bgcolor='#FFFFFF'>
  		<td>文件名称</td>
  		<td>
  			<input name=filename class="txt" value="<?php echo $filename; ?>" size=40 />
    		（不允许用 “..” 形式的路径）
  		</td>
		</tr>
	<tr  bgcolor='#f7ffdb'>
  		<td colspan='2' ><b>参考标签：</b></td>
	</tr>   <tr  bgcolor='#FFFFFF'>
      <td colspan='2' >
<?php
//foreach($dtags as $tag)
//{
	//echo '<div class="coolbg np selbt" title="'.$key.'"><a href="javascript:;" onclick="showdiv(\''.$tag.'\');"> '.$tag.' </a></div>';
//}
//echo '<a href="javascript:;" onclick="showdiv(\'\');"> 隐藏全部 </a><br />';
foreach ($helps as $key => $help)
{
	echo '<div class="coolbg np selbt" title="'.trim($help[0]).'"><a href="javascript:;" onclick="showdiv(\''.$key.'\');"> '.$key.' </a></div>'."\r\n";
	echo '<div name="help111" id="'.$key.'" class="helpdiv" ><b>标签名称：</b>'.$key.'<br /><b>功能说明：</b><br />'.trim($help[0]).'<br /><b>使用实例：</b><br /><textarea rows="5" cols="50" style="width:90%">'.trim($help[1]).'</textarea><br /><b>参数说明：</b><br />'."\r\n";
	$parameters = explode("\n", $help[2]);
	foreach($parameters as $parameter)
	{
		$parameter = trim($parameter);
		if($parameter == '') continue;
		else echo $parameter,'<br />';
	}
	echo '<div style="position:absolute; right:4px; top:4px;"><a href="###" onclick="showdiv(\'\')">关闭</a></div></div>'."\r\n";
}
?>
	  </td>
    </tr>
    <tr bgcolor='#FFFFFF'>
      <td colspan='2' >
	  <textarea name="content" cols="150" rows="24" class="txt" style="width:100%;height:450px"><?php echo $content; ?></textarea>
	  </td>
    </tr>
    <tr>
      <td height="42" colspan='2'  bgcolor='#f7ffdb'>
    <button type="submit" class="btn1">  保 存  </button>
          &nbsp;
           <button type="reset" class="btn1">取消修改</button>
          &nbsp;
           <button type="reset" class="btn1" onClick="javascript:history.go(-1);" >不理返回</button>
      </td>
    </tr>
</table>
 </form>
</body>
</html>
